<template>
  <div>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
      <el-form-item label="创建时间">
        <el-date-picker v-model="daterangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
                        type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <div class="row row-cols-auto d-flex justify-content-end mx-3">
      <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-if="true">
        导出
      </el-button>
      <!--      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
    </div>

    <el-table :data="page.records" v-loading="loading" style="width: 100%; overflow-x: scroll">
      <el-table-column label="时间" prop="createTime"></el-table-column>
      <el-table-column label="title" prop="title"></el-table-column>
      <el-table-column label="url" prop="urlLink"></el-table-column>
      <el-table-column label="ip地址" prop="ip"></el-table-column>
      <el-table-column label="用户名" prop="userName"></el-table-column>
    </el-table>
    <el-pagination :total="page.total" layout="total,prev, pager, next" @current-change="init" :page-size="page.size" :current-page.sync="page.current"></el-pagination>
  </div>
</template>

<script>
import {getJson} from "@/api/http";
import {logPage} from "@/api/api";

export default {
  name: "ImgType",
  data() {
    return {
      // 遮罩层
      loading: false,
      // 删除标志时间范围
      daterangeCreateTime: [],
      // 查询参数
      queryParams: {},
      page: {
        current: 1,
        total: 0,
        size: 10,
        records: []
      },
    };
  },
  created() {
    this.init()
  },
  methods: {
    async init() {
      let data = {
        current: this.page.current,
        size: this.page.size,
      }
      let result = await getJson(logPage, data)

      if (result.code === 1) {
        this.page = result.data;
      } else {
        this.$message('服务器发生异常');
      }
    },// 表单重置
    reset() {
      this.form = {}
    },
    /** 搜索按钮操作 */
    async handleQuery() {
      this.page.current = 1;
      await this.init();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.daterangeCreateTime = [];
      // this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 导出按钮操作 */
    handleExport() {
      // this.download('system/dept/export', {
      //   ...this.queryParams
      // }, `label_${new Date().getTime()}.xlsx`)
    },
  }
}
</script>

<style scoped>
</style>